﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NumberTest.Question;

namespace NumberTest.Answer
{
    class Edward : iNumberTest
    {
        public int CountTest(long start, long end)
        {
            int[] nums = new int[10];
            string temp;
            for (; start <= end; start++)
            {
                temp = start.ToString();
                for (int i = 0; i < temp.Length; i++)
                {
                    nums[temp[i]-'0']++;
                }
            }

            int mosttime = nums.Length-1;
            for (int i = nums.Length - 2; i >= 0; i--)
            {
                if (nums[i] >= nums[mosttime])
                {
                    mosttime = i;
                }
            }

            return mosttime;
        }



        //public int CountTest(long start, long end)
        //{
        //    //uint startpower = (uint)Math.Log10(start);
        //    //uint endpower = (uint)Math.Log10(end);
        //    string startstring = start.ToString();
        //    string endstring = end.ToString();

        //    for (int i = 0; i < startstring.Length; i++)
        //    {

        //    }



        //    throw new NotImplementedException();
        //}
    }
}
